import axios from '@/utils/axios';
import {localGet} from "@/utils";

// 获取用户列表
export function login(params,data) {
  return axios({
    url: '/user/login/'+params,
    method: 'post',
    data
  });
}

export function doLogout(params) {
  return axios({
    url: '/user/logout',
      headers: {
          'hw-token': localGet('token')
      },
    method: 'get',
    params
  });
}

// 获取当前用户信息
export function profile(params) {
  return axios({
    url: '/user/profile',
      headers: {
        'hw-token': localGet('token')
      },
    method: 'get',
    params
  });
}

// 分页查询用户列表
export function userList(data) {
  return axios({
    url: '/user/list',
    method: 'post',
    data
  });
}

export function userAdd(data) {
  return axios({
    url: '/user/add',
    method: 'post',
    data
  });
}

// 单个用户删除
export function userDelete(params) {
  return axios({
    url: '/user/delete/' + params,
    method: 'delete'
  });
}

// 用户详情
export function userDetail(params) {
  return axios({
    url: '/user/detail/' + params,
    method: 'get'
  });
}

// 用户修改
export function userUpdate(data) {
  return axios({
    url: '/user/update',
    method: 'post',
    data
  });
}

// 用户注册
export function userRegister(data) {
  return axios({
    url: '/user/register',
    method: 'post',
    data
  });
}
// 修改用户基本信息
export function updateUserInfo(data) {
  return axios({
    url: '/user/updateUserInfo',
    method: 'post',
    data
  });
}

// 充值
export function recharge(params) {
  return axios({
    url: '/user/recharge',
    method: 'get',
    params
  });
}